package com.ge.boot03web.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class WelcomeController {

    @GetMapping("/hello")
    public String hello(@RequestParam(value = "name") String userName, Model model){

        // 把需要给页面共享的数据放在Model中
        model.addAttribute("msg", userName);
        //此处返回模板的逻辑视图名
        //物理视图名 = 前缀 + 逻辑视图名 + 后缀
        return "welcome";
    }
}
